import { IconType, IconUtil } from '@xtail/vue3'
import Code from '@iconify-icons/tabler/code'
import { genFloderIcon } from '../../../utils'
import { CmdConfTypeConstType, CmdConfTypeConst } from '../consts'

/**
 * 生成命令配置中的图标配置项的默认值
 *
 * @param {CmdConfTypeConstType} type 命令配置项的类型
 * @returns {IconType} 图标配置项的默认值
 */
export const genCmdConfDefaultIcon = (
  type: CmdConfTypeConstType = CmdConfTypeConst.CMD
): IconType => {
  if (type === CmdConfTypeConst.DIR) return genFloderIcon()
  return IconUtil.genIcon({
    iconName: 'tabler:code',
    iconProps: {
      icon: Code
    }
  })
}
